package io.github.uicdb.et.item.curios;

import com.google.common.collect.Multimap;
import io.github.uicdb.et.ModElements;
import net.minecraft.ChatFormatting;
import net.minecraft.core.Holder;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.item.ItemStack;
import top.theillusivec4.curios.api.SlotContext;

import java.util.List;

public class WindWingItem extends CurioItem {
    public WindWingItem(Properties properties) {
        super(properties, 0);
    }


    @Override
    public void appendDefaultAttribute(Multimap<Holder<Attribute>, AttributeModifier> map, SlotContext slotContext, ResourceLocation id, ItemStack stack) {
        map.put(ModElements.WOOD.getElemental().getIncreasing(), getSlotModifier(slotContext, 40, AttributeModifier.Operation.ADD_VALUE));
    }

    @Override
    public void curioTick(SlotContext slotContext, ItemStack stack) {
        slotContext.entity().addEffect(new MobEffectInstance(
                MobEffects.SLOW_FALLING, 20, 0, false, false
        ));
        super.curioTick(slotContext, stack);
    }

    @Override
    public void addAdditionTooltip(List<Component> tooltips, ItemStack stack) {
        tooltips.add(
                translate("wind_wing").withStyle(ChatFormatting.LIGHT_PURPLE)
        );
    }
}
